package cn.xx.user.controller;

import cn.xx.basic.util.AjaxResult;
import cn.xx.user.domain.LoginInfo;
import cn.xx.user.service.ILoginInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginInfoController {
    @Autowired
    private ILoginInfoService loginService;

    /* 登录检查用户名密码已经登录的用户类型 */
    @PostMapping("/login")
    public AjaxResult Login(@RequestBody LoginInfo loginInfo) {
        try {
            return loginService.checkLogin(loginInfo);
        } catch (Exception e) {
            e.printStackTrace();
            return AjaxResult.me().setMsg(e.getMessage()).setSuccess(false);
        }
    }

}
